---
import {loadMetadataForDemos} from '~demos/utils/loadMetadataForDemos.js';
import Card from './Card.astro';
import TagCloudFilter from './TagCloudFilter.astro';

import lookbook from '../images/20221122-lookbook-white-fat.svg?url';
import logo from '../images/twopoint5d-glitch.png?url';

const {demos} = loadMetadataForDemos();
---

<main>
  <header class="lookbook-header">
    <img class="primary" src={logo} alt="twopoint5d" />
    <img class="secondary" src={lookbook} alt="lookbook" />
  </header>

  <TagCloudFilter />

  <ul role="list" class="demo-card-grid">
    {
      demos.map(({id, title, description, href, previewImage, tags}) => (
        <Card id={id} href={href} title={title} body={description} image={previewImage} tags={tags} />
      ))
    }
  </ul>
</main>

<style>
  main {
    margin: auto auto 3rem;
    padding: 80px 1.5rem 1.5rem;
    max-width: 120ch;
  }
  .lookbook-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    margin: 0;
    display: flex;
    justify-content: center;
    background-color: rgba(13 15 20 / 80%);
    border-bottom: 1px solid #535559;
    box-shadow: 0 0 10px #000;
  }
  .lookbook-header img.primary {
    max-height: 66px;
  }
  .lookbook-header img.secondary {
    filter: drop-shadow(0 0 2px #ccc) drop-shadow(0 0 15px #999);
    max-height: 66px;
    margin-left: 1rem;
  }
  .demo-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(32ch, 0.5fr));
    gap: 1.5rem;
    margin-top: 33px;
    padding: 0;
  }

  @media (orientation: portrait) {
    .demo-card-grid {
      grid-template-columns: repeat(auto-fit, minmax(32ch, 1fr));
    }
  }
</style>
